<?php TPL::output('global/header_meta.tpl.htm'); ?>

<body class="aw-wechat-body">
	<div class="aw-wechat-login-box">
		<h1><?php _e('微信登录'); ?></h1>
		<!--<i class="icon-wechat"></i>-->
		<p align="center"><img src="<?php echo get_js_url('/weixin/login_qr_code/'); ?>" alt="" /></p>
		<span class="info">
			<?php if ($_GET['command'] == 'REGISTER') { ?>
			<?php _e('请使用微信扫描二维码注册'); ?>
			<?php } else { ?>
			<?php _e('请使用微信扫描二维码登录'); ?>
			<?php } ?>
		</span>
	</div>

<script type="text/javascript">
	var RETURN_URL = '<?php if ($_GET['return_url']) { echo base64_decode($_GET['return_url']); } ?>';

	$(document).ready(function () {
		setInterval(function () {
			$.get(G_BASE_URL + '/account/ajax/weixin_login_process/', function (response) {
				if (response.errno == 1)
				{
					if (RETURN_URL != '')
					{
						window.location = RETURN_URL;
					}
					else
					{
						window.location.reload();
					}

				}
			}, 'json');
		}, 1500);
	});

	setInterval(function () {
		window.location.reload();
	}, 300000);
</script>
</body>
</html>